﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace DYSales.Web
{
    public class SystemInitializer : DropCreateDatabaseIfModelChanges<EntityContext>
    {
        protected override void Seed(EntityContext context)
        {
            Operator ot = new Operator();
            ot.ot_密码 = "admin";
            ot.ot_用户名 = "admin";
            ot.ot_权限组 = "admin";
            ot.ot_姓名 = "admin";
            ot.ot_启用 = true;
            ot.QcTables.Add(new QcTable() { qt_qc = "admin" });
            context.Operators.Add(ot);

            Set_table st = new Set_table();
            st.s_店名 = "东雅商店";
            st.s_打印页宽 = 250;
            st.s_字体大小 = 14;
            st.s_营业开始时间 = new DateTime(1901, 1, 1, 4, 0, 0);
            st.s_营业结束时间 = new DateTime(1901, 1, 1, 3, 30, 0);
            context.Set_tables.Add(st);

            context.SaveChanges();
        }
    }
}